Q: What is the size of the swapfile on the NeXT Computer?\
\
A: The size of the swapfile depends on the parameters set up in the
\b /etc/swaptab
\b0 configuration file and the demand for paging on the system. The swapfile will grow on demand; the demand for swapping depends on the memory needs of the running applications, and the size of the “real” memory (the more real memory the less the demand for paging space).\
\
The
\b swaptab
\b0 file looks like this:\
\
\f1\fs24\fi-20\li540 #\
# /etc/swaptab\
#\
/private/vm/swapfile lowat=20971520 # 20 Meg low water mark\
\f0\fs28\fi0\li0 \
This tells the system to use the file
\b /private/vm/swapfile
\b0 for swapping. It also specifies the parameter
\b lowat=20971520
\b0 , the “low water mark.” This low water mark is the smallest size to which the file will shrink. The paging file will then grow as needed to meet demand.\
\
A
\b hiwat=
\i n
\b0\i0 parameter may be used in the
\b swaptab
\b0 to set a limit on how large this file will grow.\
\
\
Q: What size will the
\b swapfile
\b0 be on a new disk ?\
\
A: It starts out at 16MB out of the box. It should never get smaller, since this is below the lowat mark. \
\
\
Q: Will the
\b swapfile
\b0 get smaller (if above the low water mark) while the system is running, or is it reset only upon reboot?\
\
A: The swapfile works in a stack-oriented manner — it will shrink only if the system detects that all pages above a certain address are unallocated. This rarely occurs. Consider launching a 4MB application which is completely paged out followed by one more page owned by some other application in the system. Even if the 4MB is freed the swapfile cannot be truncated until that extra page is freed. What generally happens is that long-running applications allocate a few pages at the high addresses, and
\b swapfile
\b0 apparently never shrinks.\
\
During a reboot when paging is turned on (by the invocation of
\b mach_swapon
\b0 ), the
\b swapfile
\b0 is immediately truncated to the minimum value.\
\
Note: Despite the file being called the
\b swapfile
\b0 , the NeXT operating system uses pure demand-paged memory management. mach_swapon(8) tells the kernel to initiate paging.\